﻿using System.ServiceProcess;
using DBSchemaService.Core;
using System.Xml;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System;

namespace DBSchemaService
{
    public partial class DBSchemaManagerSvc : ServiceBase
    {       
        //private MainProcessor _processor;
        private WorkItemProcessor _wiprocessor;        
        public DBSchemaManagerSvc()
        {
            InitializeComponent();
        }

        protected override void OnStart(string[] args)
        {
            try
            {                
                EventLog.WriteEntry("DB Schema service started.");
                _wiprocessor = new WorkItemProcessor();
                _wiprocessor.StartProcessor();                              
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }

        protected override void OnStop()
        {
            try
            {
                _wiprocessor.Stop();
                EventLog.WriteEntry("DB Schema service stopped.");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
    }
    
}
